<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />

    <title>xmake v2.5.7 released, Use lockfile to freeze package dependencies and Vala/Metal language support</title>
    <meta name="description" content="xmake is a lightweight cross-platform build tool based on Lua. It uses xmake.lua to maintain project builds. Compared with makefile/CMakeLists.txt, the confi...">

    
    <meta name="keywords" content="xmake,lua,C/C++,lock,package,vala,tboox" /> 

    <!-- qq oauth -->
    <meta property="qc:admins" content="5211601217706727767255" />

    <!--icon -->
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" sizes="192x192" href="/static/img/nice-highres.png" />
	<link rel="apple-touch-icon-precomposed" href="/static/img/apple-touch-icon-57x57-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/img/apple-touch-icon-72x72-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/img/apple-touch-icon-114x114-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/img/apple-touch-icon-144x144-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="180x180" href="/static/img/retinahd_icon.png" />
	<meta name="msapplication-TileImage" content="/static/img/retinahd_icon.png" />
	
    <link rel="stylesheet" href=" /css/fontawesome/css/font-awesome.min.css ">
    <link rel="stylesheet" href=" /css/main.css ">
    <link rel="canonical" href="https://tboox.org/2021/08/29/xmake-update-v2.5.7/">
    <link rel="alternate" type="application/rss+xml" title="TBOOX Open Source Project" href="https://tboox.org/feed.xml ">
    <link rel="alternate" hreflang="en" href="https://tboox.org/" />
    <link rel="alternate" hreflang="zh-Hans" href="https://tboox.org/cn/" />




    <script type="text/javascript">
    function isPC(){    
        var userAgentInfo = navigator.userAgent;  
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");    
        var flag = true;    
        for (var v = 0; v < Agents.length; v++) {    
            if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }    
        }    
        return flag;    
    }
    </script>

<!-- baidu ads -->



    <!-- baidu ads -->

</head>


  <body>

    <header id="top">
    <div class="wrapper">
        <a href="/" class="brand">TBOOX</a>
        <button id="headerMenu" class="menu"><i class="fa fa-bars"></i></button>
        <nav id="headerNav">
            <ul>
                <li>
                    
                    <a href="/cn?lang=0">
                    
                        <i class="fa fa-home"></i>中文
                    </a>
                </li>

                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/project/">
                            
                        
                            <i class="fa fa-bookmark"></i>Projects
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/archive/">
                            
                        
                            <i class="fa fa-archive"></i>Archives
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/category/">
                            
                        
                            <i class="fa fa-th-list"></i>Categories
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/tag/">
                            
                        
                            <i class="fa fa-tags"></i>Tags
                        </a>
                    </li>
                    
                    
                    
                
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/docs/">
                            
                        
                            <i class="fa fa-book"></i>Documents
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="https://xmake.io/#/about/contact" target="_blank" >
                            
                        
                            <i class="fa fa-forumbee"></i>Community
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/donation/">
                            
                        
                            <i class="fa fa-heart"></i>Donate
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/about/">
                            
                        
                            <i class="fa fa-user"></i>About
                        </a>
                    </li>
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                     
                     
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            </ul>
        </nav>
    </div>
</header>



        <div class="page clearfix" post>
    <div class="left">
        <h1>xmake v2.5.7 released, Use lockfile to freeze package dependencies and Vala/Metal language support</h1>
        <div class="label">

            <div class="label-card">
                <i class="fa fa-calendar"></i>2021-08-29
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
            


<!-- <span class="point">•</span> -->
<span class="categories">
  <i class="fa fa-th-list"></i>
  
    
        <a href="/category/#xmake" title="Category: xmake" rel="category">xmake</a>
    
  

  <!-- <span class="point">•</span> -->
</span>


            </div>

            <div class="label-card">
            
<!-- <span class="point">•</span> -->
<span class="pageTag">
  <i class="fa fa-tags"></i>
  
    
        <!--a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a-->
        <a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a>&nbsp;
    
        <!--a href="/tag/#lua" title="Tag: lua" rel="tag">lua</a-->
        <a href="/tag/#lua" title="Tag: lua" rel="tag">lua</a>&nbsp;
    
        <!--a href="/tag/#C%2FC%2B%2B" title="Tag: C/C++" rel="tag">C/C++</a-->
        <a href="/tag/#C/C++" title="Tag: C/C++" rel="tag">C/C++</a>&nbsp;
    
        <!--a href="/tag/#lock" title="Tag: lock" rel="tag">lock</a-->
        <a href="/tag/#lock" title="Tag: lock" rel="tag">lock</a>&nbsp;
    
        <!--a href="/tag/#package" title="Tag: package" rel="tag">package</a-->
        <a href="/tag/#package" title="Tag: package" rel="tag">package</a>&nbsp;
    
        <!--a href="/tag/#vala" title="Tag: vala" rel="tag">vala</a-->
        <a href="/tag/#vala" title="Tag: vala" rel="tag">vala</a>
    
  

</span>

            </div>

        </div>
        <hr>
        <article itemscope itemtype="http://schema.org/BlogPosting">
        <p><a href="https://github.com/xmake-io/xmake">xmake</a> is a lightweight cross-platform build tool based on Lua. It uses xmake.lua to maintain project builds. Compared with makefile/CMakeLists.txt, the configuration syntax is more Concise and intuitive, it is very friendly to novices, and you can get started quickly in a short time, allowing users to focus more on actual project development.</p>

<p>In this version, we have added a lot of new features. Not only did we increase the compilation support for Vala and Metal languages, we also improved the package dependency management, which can support the locking and updating of dependent packages like npm/package.lock, so The user’s project will not be affected by the update and change of the upstream package repository.</p>

<p>In addition, we also provide some more practical rules. For example, <code class="highlighter-rouge">utils.bin2c</code> allows users to easily and quickly embed some binary resource files into the code, and obtain relevant data in the form of header files.</p>

<ul>
  <li><a href="https://github.com/xmake-io/xmake">Github</a></li>
  <li><a href="https://xmake.io/">Document</a></li>
</ul>

<h2 id="new-feature-introduction">New feature introduction</h2>

<h3 id="added-vala-language-support">Added Vala language support</h3>

<p>In this version, we can already initially support the construction of Vala programs, just apply the <code class="highlighter-rouge">add_rules("vala")</code> rule.</p>

<p>At the same time, we need to add some dependency packages, among which the glib package is necessary because Vala itself will also use it.</p>

<p><code class="highlighter-rouge">add_values("vala.packages")</code> is used to tell valac which packages the project needs, it will introduce the vala api of the relevant package, but the dependency integration of the package still needs to be downloaded and integrated through <code class="highlighter-rouge">add_requires("lua")</code>.</p>

<p>E.g:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.release"</span><span class="p">,</span> <span class="s2">"mode.debug"</span><span class="p">)</span>

<span class="n">add_requires</span><span class="p">(</span><span class="s2">"lua"</span><span class="p">,</span> <span class="s2">"glib"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_rules</span><span class="p">(</span><span class="s2">"vala"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.vala"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"lua"</span><span class="p">,</span> <span class="s2">"glib"</span><span class="p">)</span>
    <span class="n">add_values</span><span class="p">(</span><span class="s2">"vala.packages"</span><span class="p">,</span> <span class="s2">"lua"</span><span class="p">)</span>
</code></pre>
</div>

<p>More examples: <a href="https://github.com/xmake-io/xmake/tree/master/tests/projects/vala">Vala examples</a></p>

<h3 id="added-package-dependency-lock-support">Added package dependency lock support</h3>

<p>This feature is similar to npm’s package.lock and cargo’s cargo.lock.</p>

<p>For example, if we quote some packages, by default, if the version is not specified, xmake will automatically pull the latest version of the package for integrated use each time, for example:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"zlib"</span><span class="p">)</span>
</code></pre>
</div>

<p>However, if the upstream package repository is updated and changed, for example, zlib adds a new version 1.2.11, or the installation script is changed, the user’s dependent packages will change.</p>

<p>This can easily lead to some projects that were originally compiled and passed, and there may be some unstable factors due to changes in dependent packages, and the compilation may fail, etc.</p>

<p>In order to ensure that the package used by the user’s project is fixed each time, we can enable the package dependency lock through the following configuration.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">set_policy</span><span class="p">(</span><span class="s2">"package.requires_lock"</span><span class="p">,</span> <span class="kc">true</span><span class="p">)</span>
</code></pre>
</div>

<p>This is a global setting and must be set to the global root scope. If enabled, xmake will automatically generate a <code class="highlighter-rouge">xmake-requires.lock</code> configuration file after executing package pull.</p>

<p>It contains all the packages that the project depends on, as well as the current package version and other information.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="p">{</span>
    <span class="n">__meta__</span> <span class="o">=</span> <span class="p">{</span>
        <span class="n">version</span> <span class="o">=</span> <span class="s2">"1.0"</span>
    <span class="p">},</span>
    <span class="p">[</span><span class="s2">"macosx|x86_64"</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
        <span class="p">[</span><span class="s2">"cmake#31fecfc4"</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
            <span class="n">repo</span> <span class="o">=</span> <span class="p">{</span>
                <span class="n">branch</span> <span class="o">=</span> <span class="s2">"master"</span><span class="p">,</span>
                <span class="n">commit</span> <span class="o">=</span> <span class="s2">"4498f11267de5112199152ab030ed139c985ad5a"</span><span class="p">,</span>
                <span class="n">url</span> <span class="o">=</span> <span class="s2">"https://github.com/xmake-io/xmake-repo.git"</span>
            <span class="p">},</span>
            <span class="n">version</span> <span class="o">=</span> <span class="s2">"3.21.0"</span>
        <span class="p">},</span>
        <span class="p">[</span><span class="s2">"glfw#31fecfc4"</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
            <span class="n">repo</span> <span class="o">=</span> <span class="p">{</span>
                <span class="n">branch</span> <span class="o">=</span> <span class="s2">"master"</span><span class="p">,</span>
                <span class="n">commit</span> <span class="o">=</span> <span class="s2">"eda7adee81bac151f87c507030cc0dd8ab299462"</span><span class="p">,</span>
                <span class="n">url</span> <span class="o">=</span> <span class="s2">"https://github.com/xmake-io/xmake-repo.git"</span>
            <span class="p">},</span>
            <span class="n">version</span> <span class="o">=</span> <span class="s2">"3.3.4"</span>
        <span class="p">},</span>
        <span class="p">[</span><span class="s2">"opengl#31fecfc4"</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
            <span class="n">repo</span> <span class="o">=</span> <span class="p">{</span>
                <span class="n">branch</span> <span class="o">=</span> <span class="s2">"master"</span><span class="p">,</span>
                <span class="n">commit</span> <span class="o">=</span> <span class="s2">"94d2eee1f466092e04c5cf1e4ecc8c8883c1d0eb"</span><span class="p">,</span>
                <span class="n">url</span> <span class="o">=</span> <span class="s2">"https://github.com/xmake-io/xmake-repo.git"</span>
            <span class="p">}</span>
        <span class="p">}</span>
    <span class="p">}</span>
<span class="p">}</span>
</code></pre>
</div>

<p>Of course, we can also execute the following command to force the upgrade package to the latest version.</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code><span class="w">$ </span><span class="nc">xmake</span><span class="kv"> require --upgrade
</span>upgrading packages ..
  zlib: 1.2.10 -&gt; 1.2.11
1 package is upgraded!
</code></pre>
</div>

<h3 id="option-supports-runtime-detection-of-code-snippets">option supports runtime detection of code snippets</h3>

<p>Option itself provides two interfaces <code class="highlighter-rouge">add_csnippets/add_cxxsnippets</code>, which are used to quickly detect whether a specific piece of c/c++ code has been compiled, and if the compilation passes, the corresponding option option will be enabled.</p>

<p>But the previous version can only provide compile-time detection, and in the new version, we also added runtime detection support.</p>

<p>We can set the two parameters <code class="highlighter-rouge"><span class="p">{</span><span class="err">tryrun</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="err">true</span><span class="p">}</span></code> and <code class="highlighter-rouge"><span class="p">{</span><span class="err">output</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="err">true</span><span class="p">}</span></code> to try to run detection and capture output.</p>

<h4 id="try-to-run-the-test">Try to run the test</h4>

<p>Set tryrun to try to run to detect</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">option</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">add_cxxsnippets</span><span class="p">(</span><span class="s2">"HAS_INT_4"</span><span class="p">,</span> <span class="s2">"return (sizeof(int) == 4)? 0: -1;"</span><span class="p">,</span> <span class="p">{</span><span class="n">tryrun</span> <span class="o">=</span> <span class="kc">true</span><span class="p">})</span>
</code></pre>
</div>

<p>If the compile and run pass, the test option will be enabled.</p>

<h4 id="detect-and-capture-output-at-runtime">Detect and capture output at runtime</h4>

<p>Setting output will also try to detect and additionally capture the output content of the run.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">option</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">add_cxxsnippets</span><span class="p">(</span><span class="s2">"INT_SIZE"</span><span class="p">,</span><span class="s1">'printf("%d", sizeof(int)); return 0;'</span><span class="p">,</span> <span class="p">{</span><span class="n">output</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="n">number</span> <span class="o">=</span> <span class="kc">true</span><span class="p">})</span>
</code></pre>
</div>

<p>If the compile and run pass, the test option will be enabled, and the corresponding output content can be obtained as the value of option.</p>

<p>Note: Set to capture output, the current option cannot set other snippets</p>

<p>We can also get the output bound to the option through <code class="highlighter-rouge">is_config</code>.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="k">if</span> <span class="n">is_config</span><span class="p">(</span><span class="s2">"test"</span><span class="p">,</span> <span class="s2">"8"</span><span class="p">)</span> <span class="n">tben</span>
    <span class="o">-</span> <span class="n">xxx</span>
<span class="k">end</span>
</code></pre>
</div>

<p>In addition, we have also improved the auxiliary detection interface of <code class="highlighter-rouge">includes("check_csnippets")</code> to support runtime detection.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">includes</span><span class="p">(</span><span class="s2">"check_csnippets.lua"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"*.c"</span><span class="p">)</span>
    <span class="n">add_configfiles</span><span class="p">(</span><span class="s2">"config.h.in"</span><span class="p">)</span>

    <span class="n">check_csnippets</span><span class="p">(</span><span class="s2">"HAS_INT_4"</span><span class="p">,</span> <span class="s2">"return (sizeof(int) == 4)? 0: -1;"</span><span class="p">,</span> <span class="p">{</span><span class="n">tryrun</span> <span class="o">=</span> <span class="kc">true</span><span class="p">})</span>
    <span class="n">check_csnippets</span><span class="p">(</span><span class="s2">"INT_SIZE"</span><span class="p">,</span><span class="s1">'printf("%d", sizeof(int)); return 0;'</span><span class="p">,</span> <span class="p">{</span><span class="n">output</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="n">number</span> <span class="o">=</span> <span class="kc">true</span><span class="p">})</span>
    <span class="n">configvar_check_csnippets</span><span class="p">(</span><span class="s2">"HAS_LONG_8"</span><span class="p">,</span> <span class="s2">"return (sizeof(long) == 8)? 0: -1;"</span><span class="p">,</span> <span class="p">{</span><span class="n">tryrun</span> <span class="o">=</span> <span class="kc">true</span><span class="p">})</span>
    <span class="n">configvar_check_csnippets</span><span class="p">(</span><span class="s2">"PTR_SIZE"</span><span class="p">,</span><span class="s1">'printf("%d", sizeof(void*)); return 0;'</span><span class="p">,</span> <span class="p">{</span><span class="n">output</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="n">number</span> <span class="o">=</span> <span class="kc">true</span><span class="p">})</span>
</code></pre>
</div>

<p>If capture output is enabled, <code class="highlighter-rouge">${define PTR_SIZE}</code> in <code class="highlighter-rouge">config.h.in</code> will automatically generate <code class="highlighter-rouge">#define PTR_SIZE 4</code>.</p>

<p>Among them, the <code class="highlighter-rouge">number = true</code> setting can be forced as a number instead of a string value, otherwise it will be defined as <code class="highlighter-rouge">#define PTR_SIZE "4"</code> by default</p>

<h3 id="quickly-embed-binary-resource-files-into-code">Quickly embed binary resource files into code</h3>

<p>We can use the <code class="highlighter-rouge">utils.bin2c</code> rule to introduce some binary files into the project, and see them as c/c++ header files for developers to use to obtain the data of these files.</p>

<p>For example, we can embed some png/jpg resource files into the code in the project.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"console"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binart"</span><span class="p">)</span>
    <span class="n">add_rules</span><span class="p">(</span><span class="s2">"utils.bin2c"</span><span class="p">,</span> <span class="p">{</span><span class="n">extensions</span> <span class="o">=</span> <span class="p">{</span><span class="s2">".png"</span><span class="p">,</span> <span class="s2">".jpg"</span><span class="p">}})</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"res/*.png"</span><span class="p">,</span> <span class="s2">"res/*.jpg"</span><span class="p">)</span>
</code></pre>
</div>

<p>Note: The setting of extensions is optional, the default suffix is ​​.bin</p>

<p>Then, we can import and use it through <code class="highlighter-rouge">#include "filename.png.h"</code>, xmake will automatically generate the corresponding header file for you, and add the corresponding search directory.</p>

<div class="language-c highlighter-rouge"><pre class="highlight"><code><span class="k">static</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="n">g_png_data</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span>
    <span class="cp">#include "image.png.h"
</span><span class="p">};</span>

<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">**</span> <span class="n">argv</span><span class="p">)</span>
<span class="p">{</span>
    <span class="n">printf</span><span class="p">(</span><span class="s">"image.png: %s, size: %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">g_png_data</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">g_png_data</span><span class="p">));</span>
    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
</code></pre>
</div>

<p>The content of the generated header file is similar:</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code>cat build/.gens/test/macosx/x86_64/release/rules/c++/bin2c/image.png.h
  0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x78, 0x6D, 0x61, 0x6B, 0x65, 0x21, 0x0A, 0x00
</code></pre>
</div>

<h3 id="added-iosmacos-application-metal-compilation-support">Added iOS/macOS application Metal compilation support</h3>

<p>We know that the <code class="highlighter-rouge">xcode.application</code> rule can compile iOS/macOS applications, generate .app/.ipa packages, and complete the signature operation at the same time.</p>

<p>However, it did not support the compilation of code with .metal before. In the new version, we have added the <code class="highlighter-rouge">xcode.metal</code> rule, which is associated with the <code class="highlighter-rouge">xcode.application</code> rule by default to support metal compilation by default.</p>

<p>xmake will automatically compile .metal and then package to generate the default.metallib file, and it will be built into .app/.ipa automatically.</p>

<p>If the user’s metal is accessed through <code class="highlighter-rouge">[_device newDefaultLibrary]</code>, it can be automatically supported, just like compiling with xcode.</p>

<p>Here is a complete one we provide: <a href="https://github.com/xmake-io/xmake/blob/master/tests/projects/objc/metal_app/xmake.lua">Project Example</a>.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.debug"</span><span class="p">,</span> <span class="s2">"mode.release"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"HelloTriangle"</span><span class="p">)</span>
    <span class="n">add_rules</span><span class="p">(</span><span class="s2">"xcode.application"</span><span class="p">)</span>
    <span class="n">add_includedirs</span><span class="p">(</span><span class="s2">"Renderer"</span><span class="p">)</span>
    <span class="n">add_frameworks</span><span class="p">(</span><span class="s2">"MetalKit"</span><span class="p">)</span>
    <span class="n">add_mflags</span><span class="p">(</span><span class="s2">"-fmodules"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"Renderer/*.m"</span><span class="p">,</span> <span class="s2">"Renderer/*.metal"</span><span class="p">)</span> <span class="c1">------- add metal files</span>
    <span class="k">if</span> <span class="n">is_plat</span><span class="p">(</span><span class="s2">"macosx"</span><span class="p">)</span> <span class="k">then</span>
        <span class="n">add_files</span><span class="p">(</span><span class="s2">"Application/main.m"</span><span class="p">)</span>
        <span class="n">add_files</span><span class="p">(</span><span class="s2">"Application/AAPLViewController.m"</span><span class="p">)</span>
        <span class="n">add_files</span><span class="p">(</span><span class="s2">"Application/macOS/Info.plist"</span><span class="p">)</span>
        <span class="n">add_files</span><span class="p">(</span><span class="s2">"Application/macOS/Base.lproj/*.storyboard"</span><span class="p">)</span>
        <span class="n">add_defines</span><span class="p">(</span><span class="s2">"TARGET_MACOS"</span><span class="p">)</span>
        <span class="n">add_frameworks</span><span class="p">(</span><span class="s2">"AppKit"</span><span class="p">)</span>
    <span class="k">elseif</span> <span class="n">is_plat</span><span class="p">(</span><span class="s2">"iphoneos"</span><span class="p">)</span> <span class="k">then</span>
        <span class="n">add_files</span><span class="p">(</span><span class="s2">"Application/*.m"</span><span class="p">)</span>
        <span class="n">add_files</span><span class="p">(</span><span class="s2">"Application/iOS/Info.plist"</span><span class="p">)</span>
        <span class="n">add_files</span><span class="p">(</span><span class="s2">"Application/iOS/Base.lproj/*.storyboard"</span><span class="p">)</span>
        <span class="n">add_frameworks</span><span class="p">(</span><span class="s2">"UIKit"</span><span class="p">)</span>
        <span class="n">add_defines</span><span class="p">(</span><span class="s2">"TARGET_IOS"</span><span class="p">)</span>
</code></pre>
</div>

<p>For example, on macOS, after compiling and running, the desired effect will be rendered through metal.</p>

<p><img src="/static/img/xmake/xmake-metal.png" alt="" /></p>

<p>If our project does not use the default metal library, we can also use the above-mentioned <code class="highlighter-rouge">utils.bin2c</code> rule as a source file and embed it into the code library, for example:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"utils.bin2c"</span><span class="p">,</span> <span class="p">{</span><span class="n">extensions</span> <span class="o">=</span> <span class="s2">".metal"</span><span class="p">})</span>
<span class="n">add_files</span><span class="p">(</span><span class="s2">"Renderer/*.metal"</span><span class="p">)</span>
</code></pre>
</div>

<p>Then in the code, we can access:</p>

<div class="language-c highlighter-rouge"><pre class="highlight"><code><span class="k">static</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="n">g_metal_data</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span>
    <span class="cp">#include "xxx.metal.h"
</span><span class="p">};</span>

<span class="n">id</span><span class="o">&lt;</span><span class="n">MTLLibrary</span><span class="o">&gt;</span> <span class="n">library</span> <span class="o">=</span> <span class="p">[</span><span class="n">_device</span> <span class="n">newLibraryWithSource</span><span class="o">:</span><span class="p">[[</span><span class="n">NSString</span> <span class="n">stringWithUTF8String</span><span class="o">:</span><span class="n">g_metal_data</span><span class="p">]]</span> <span class="n">options</span><span class="o">:</span><span class="n">nil</span> <span class="n">error</span><span class="o">:&amp;</span><span class="n">error</span><span class="p">];</span>
</code></pre>
</div>

<h3 id="improve-add_repositories">Improve add_repositories</h3>

<p>If we use the local repository built into the project, we used to introduce it through <code class="highlighter-rouge">add_repositories("myrepo repodir")</code>.</p>

<p>However, it is not based on the relative directory of the current xmake.lua file directory like <code class="highlighter-rouge">add_files()</code>, and there is no automatic path conversion, so it is easy to encounter the problem of not being able to find the repo.</p>

<p>Therefore, we have improved it, and you can specify the corresponding root directory location through an additional rootdir parameter, such as the script directory relative to the current xmake.lua.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_repositories</span><span class="p">(</span><span class="s2">"myrepo repodir"</span><span class="p">,</span> <span class="p">{</span><span class="n">rootdir</span> <span class="o">=</span> <span class="n">os</span><span class="p">.</span><span class="n">scriptdir</span><span class="p">()})</span>
</code></pre>
</div>

<h3 id="oscp-supports-symbolic-links">os.cp supports symbolic links</h3>

<p>In the previous version, the <code class="highlighter-rouge">os.cp</code> interface could not handle the copying of symbolic links very well. It would automatically expand the link and copy the actual file content, which would only cause the symbolic link to be lost after copying.</p>

<p>If you want to keep the symbolic link as it is after copying, you only need to set the following parameter: <code class="highlighter-rouge"><span class="p">{</span><span class="err">symlink</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="err">true</span><span class="p">}</span></code></p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">os</span><span class="p">.</span><span class="n">cp</span><span class="p">(</span><span class="s2">"/xxx/symlink"</span><span class="p">,</span> <span class="s2">"/xxx/dstlink"</span><span class="p">,</span> <span class="p">{</span><span class="n">symlink</span> <span class="o">=</span> <span class="kc">true</span><span class="p">})</span>
</code></pre>
</div>

<h3 id="compile-automatically-generated-code-more-easily">Compile automatically generated code more easily</h3>

<p>Sometimes, we have such a requirement to automatically generate some source files to participate in the later code compilation before compilation. But because the files added by <code class="highlighter-rouge">add_files</code> are already determined when the compilation is executed, they cannot be added dynamically during the compilation process (because parallel compilation is required).</p>

<p>Therefore, to achieve this requirement, we usually need to customize a rule, and then actively call the compiler module to deal with a series of issues such as compilation of generated code, injection of object files, and dependency updates.</p>

<p>This is not a big problem for the xmake developers themselves, but for users, it is still more cumbersome and difficult to get started.</p>

<p>In the new version, we have improved the support for <code class="highlighter-rouge">add_files</code> and added the <code class="highlighter-rouge"><span class="p">{</span><span class="err">always_added</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="err">true</span><span class="p">}</span></code> configuration to tell xmake that we always need to add the specified source file, even if it does not exist yet.</p>

<p>In this way, we can rely on the default compilation process of xmake to compile the automatically generated code, like this:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.debug"</span><span class="p">,</span> <span class="s2">"mode.release"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"autogen_code"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"$(buildir)/autogen.cpp"</span><span class="p">,</span> <span class="p">{</span><span class="n">always_added</span> <span class="o">=</span> <span class="kc">true</span><span class="p">})</span>
    <span class="n">before_build</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">)</span>
        <span class="n">io</span><span class="p">.</span><span class="n">writefile</span><span class="p">(</span><span class="s2">"$(buildir)/autogen.cpp"</span><span class="p">,</span> <span class="s">[[
#include &lt;iostream&gt;

using namespace std;

int main(int argc, char** argv)
{
    cout &lt;&lt; "hello world!" &lt;&lt; endl;
    return 0;
}
        ]]</span><span class="p">)</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p>There is no need for additional rule definitions, only the compilation order needs to be guaranteed, and the code files are generated at the correct stage.</p>

<p>However, we also need to pay attention that since the currently automatically generated source files may not yet exist, we cannot use pattern matching in <code class="highlighter-rouge">add_files</code>, and can only explicitly add each source file path.</p>

<h2 id="changelog">Changelog</h2>

<h3 id="new-features">New features</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/1534">#1534</a>: Support to compile Vala lanuage project</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1544">#1544</a>: Add utils.bin2c rule to generate header from binary file</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1547">#1547</a>: Support to run and get output of c/c++ snippets in option</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1567">#1567</a>: Package “lock file” support to freeze dependencies</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1597">#1597</a>: Support to compile *.metal files to generate *.metalib and improve xcode.application rule</li>
</ul>

<h3 id="change">Change</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/1540">#1540</a>: Better support for compilation of automatically generated code</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1578">#1578</a>: Improve add_repositories to support relative path better</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1582">#1582</a>: Improve installation and os.cp to reserve symlink</li>
</ul>

<h3 id="bugs-fixed">Bugs fixed</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/1531">#1531</a>: Fix error info when loading targets failed</li>
</ul>


        </article>
        <hr>

        <!-- baidu ads -->
        

        
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
                    
                    <h2 id="chinese">中文</h2>
                    <ul>
                    
                    <li class="relatedPost">
                        <a href="/cn/2021/08/29/xmake-update-v2.5.7/">xmake v2.5.7 发布，包依赖锁定和 Vala/Metal 语言编译支持
                        
                        </a>
                    </li>
                    
                    
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
        
            </ul>
        

        
        
            
            
            
                
                    
                        
                        <h2 id="similar_posts">Similar Posts</h2>
                        <ul>
                        
                        <li class="relatedPost">
                            <a href="/2021/12/17/xmake-update-v2.6.2/">Xmake v2.6.2 released, Support building Linux kernel driver module
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/12/03/xmake-update-v2.6.1/">xmake v2.6.1 released, Switch to Lua5.4 runtime, Support Rust and C++ mixed compilation
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/10/30/xmake-update-v2.5.9/">xmake v2.5.9 released, Improve C++20 Modules and support Nim, Keil MDK and Unity Build
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/10/08/xmake-update-v2.5.8/">xmake v2.5.8 is released, Support Pascal/Swig program and Lua53 runtime
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/07/26/xmake-update-v2.5.6/">xmake v2.5.6 released, Improve compatibility of pre-compiled binary package
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
        
            </ul>
        

        <div class="post-recent">
    <div class="pre">

        

        

        
        
        

        

        

        
        
        <p><strong>Prev Post</strong> <a href="/2021/07/26/xmake-update-v2.5.6/">xmake v2.5.6 released, Improve compatibility of pre-compiled binary package</a></p>
        
    </div>

    <div class="nex">

        

        

        
        
        

        

        

        
        
        <p><strong>Next Post</strong> <a href="/2021/10/08/xmake-update-v2.5.8/">xmake v2.5.8 is released, Support Pascal/Swig program and Lua53 runtime</a></p>
        
    </div>
</div>


        <h2 id="comments">Comments</h2>
        






<div id="gitalk-container"></div>
<link rel="stylesheet" href="/css/gitalk.css">
<script src="/js/gitalk.min.js"></script>

<script>
const gitalk = new Gitalk({
  clientID: '73946dc1d9e2276ad0da',
  clientSecret: '12a3cb94361ba3ebc6ecb68cf80d592bfaa8106d',
  repo: 'tboox.github.io',
  owner: 'waruqi',
  admin: ['waruqi'],
  id: location.pathname,      
  language: 'en',
  distractionFreeMode: false  
})

gitalk.render('gitalk-container')
</script>





    </div>
    <button class="anchor"><i class="fa fa-anchor"></i></button>
    <div class="right">
        <div class="wrap">


            <!-- codefund ads -->
            

            <!-- Content -->
            <div class="side content">
                <div>
                    Content
                </div>
                <ul id="content-side" class="content-ul">
                    <li><a href="#chinese">中文</a></li>
                    <li><a href="#similar_posts">Similar Posts</a></li>
                    <li><a href="#comments">Comments</a></li>
                </ul>
            </div>

            <!-- baidu ads -->
            

            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    Links
                </div>
                <ul class="content-ul">
                  <li><a href="http://github.com/waruqi/tbox">tbox</a></li>
                  <li><a href="http://www.xmake.io">xmake</a></li>
                  <li><a href="https://github.com/waruqi">github</a></li>
                </ul>
            </div> 

            <!-- google ads -->
            

            <!-- baidu ads -->
            

            <!-- chitika ads -->
            
        </div>
    </div>

    <!-- baidu ads -->
    
</div>
<script>
/**
 * target _blank
 */
(function() {
    var aTags = document.querySelectorAll('article a:not([id])')
    for (var i = 0; i < aTags.length; i++) {
        aTags[i].setAttribute('target', '_blank')
    }
}());
</script>
<script src="/js/pageContent.js " charset="utf-8"></script>



    <footer class="site-footer">
    <div class="wrapper">
        <p class="description">
             Copyright (c) 2016-2020 tboox.org 
        </p>
        <p class="contact">
            
            <a href="https://github.com/waruqi" title="GitHub"><i class="fa fa-github" aria-hidden="true"></i></a> 
             
            
            <a href="mailto:waruqi@gmail.com" title="email"><i class="fa fa-envelope-o" aria-hidden="true"></i></a> 
            
            
            <a href="https://twitter.com/waruqi" title="Twitter"><i class="fa fa-twitter" aria-hidden="true"></i></a> 
            
            <a href="/feed.xml" title="feed"><i class="fa fa-feed" aria-hidden="true"></i></a> 
        </p>
        <p class="power">
            <span>
                Site powered by <a href="https://jekyllrb.com/">Jekyll</a> & <a href="https://github.com/Gaohaoyang">HyG</a> & <a href="https://pages.github.com/">Github Pages</a>.
            </span>
        </p>
    </div>
</footer>

    <div class="back-to-top">
    <a href="#top" class="scroll">
        <i class="fa fa-arrow-up" aria-hidden="true"></i>
    </a>
</div>

    <script src=" /js/main.js " charset="utf-8"></script>
    <script src=" /js/scroll.min.js " charset="utf-8"></script>
  </body>

</html>
